#include "linux/clockchips.h"
#include "linux/printk.h"
#include "linux/clocksource.h"
#include "linux/init.h"
#include "linux/of.h"

extern struct of_device_id __clksrc_of_table[];

void clocksource_probe(void)
{
    struct device_node *np;
    struct of_device_id *match;
    of_init_fn_1_ret init_func_ret;
    unsigned clocksources = 0;
    int ret;

    for_each_matching_node_and_match(np, __clksrc_of_table, &match)
    {
        if (!of_device_is_available(np))
            continue;

        init_func_ret = match->data;

        ret = init_func_ret(np);
        if (ret)
        {
            printk("Failed to initialize '%s': %d", of_node_full_name(np), ret);
            continue;
        }

        clocksources++;
    }
}
